import createAxios from '/@/utils/axios'

export const controllerUrl = '/user/order.PlaceOrder/'

// 生成临时订单
export function generateTempOrderApi(data: anyObj) {
    return createAxios(
        {
            url: controllerUrl + 'generateTempOrder',
            method: 'post',
            data: data,
        },
        {
            showSuccessMessage: false,
        }
    )
}

// 生成订单
export function generateOrderApi(data: anyObj) {
    return createAxios(
        {
            url: controllerUrl + 'generateOrder',
            method: 'post',
            data: data,
        },
        {
            showSuccessMessage: false,
        }
    )
}

// 修改临时订单的数量
export function updateOrderGoodsTempNumApi(data: anyObj) {
    return createAxios(
        {
            url: controllerUrl + 'updateOrderGoodsTempNum',
            method: 'post',
            data: data,
        },
        {
            showSuccessMessage: true,
        }
    )
}

// 保存临时订单
export function saveOrderTemp(data: anyObj) {
    return createAxios(
        {
            url: controllerUrl + 'saveOrderTemp',
            method: 'post',
            data: data,
        },
        {
            showSuccessMessage: false,
        }
    )
}

export function getUserInfo(userId: number) {
    return createAxios({
        url: controllerUrl + 'getUserInfo',
        method: 'get',
        params: {
            user_id: userId,
        },
    })
}

